package com.sinosoft.cpyy.util.number;

import java.math.BigDecimal;

public final class RoundTool {
    public static BigDecimal round(double paramDouble, int paramInt1, int paramInt2) {
        BigDecimal localBigDecimal = new BigDecimal(paramDouble + "");
        localBigDecimal = localBigDecimal.setScale(paramInt1, paramInt2);
        BigDecimal d = localBigDecimal;
        localBigDecimal = null;
        return d;
    }

    public static BigDecimal round(BigDecimal localBigDecimal, int paramInt1, int paramInt2) {
        localBigDecimal = localBigDecimal.setScale(paramInt1, paramInt2);
        BigDecimal d = localBigDecimal;
        localBigDecimal = null;
        return d;
    }

    public static void main(String[] paramArrayOfString) {
        System.out.println(round(12.001D, 2, 0));
        System.out.println(round(-12.3401D, 2, 0));
        System.out.println(round(12.349D, 2, 1));
        System.out.println(round(-12.349D, 2, 1));
        System.out.println(round(12.3401D, 2, 2));
        System.out.println(round(-12.349D, 2, 2));
        System.out.println(round(12.349D, 2, 3));
        System.out.println(round(-12.3401D, 2, 3));
        System.out.println(round(12.345000000000001D, 2, 4));
        System.out.println(round(12.344900000000001D, 2, 4));
        System.out.println(round(-12.345000000000001D, 2, 4));
        System.out.println(round(-12.344900000000001D, 2, 4));
        System.out.println(round(12.345000000000001D, 2, 5));
        System.out.println(round(12.344900000000001D, 2, 5));
        System.out.println(round(-12.345000000000001D, 2, 5));
        System.out.println(round(-12.344900000000001D, 2, 5));
        System.out.println(round(12.346D, 2, 6));
        System.out.println(round(12.345000000000001D, 2, 6));
    }
}